﻿
using Bootstrap5.Abstractions;

using Microsoft.AspNetCore.Components;

namespace Bootstrap5;

[CssClass("navbar-brand")]
public class NavBarBrand : BootstrapChildContentComponentBase
{
    [CascadingParameter] NavBar Parent { get; set; }
    [Parameter] public bool Texted { get; set; }

    protected override void OnInitialized()
    {
        if(Parent is null)
        {
            throw new CascadingValueNullException(nameof(NavBarBrand), nameof(NavBar));
        }
    }

    protected override string GetHtmlTagName()
    {
        if (Texted)
        {
            return "span";
        }
        return "a";
    }
}
